package com.ljcalc.business.components.fetchers;

import java.net.URL;
import java.util.List;

import com.ljcalc.business.components.requests.IntegerUserRequest;

import junit.framework.TestCase;

public class HTTPFetcherTest extends TestCase {

	public void setUp() throws Exception{
		
	}
	
	public void tearDown() throws Exception{
		
	}
	
	public void testFetchContent() throws Exception{
		IntegerUserRequest ur = new IntegerUserRequest(10, 1,6,1,10, IntegerUserRequest.FORMAT_PLAIN, IntegerUserRequest.RND_NEW);
		String urlstr = ur.getURLStr();
		assertEquals(urlstr, "http://www.random.org/integers/?num=10&min=1&max=6&col=1&base=10&format=plain&rnd=new");
		HTTPFetcher f = new HTTPFetcher(ur.getURLStr());
		f.loadContent();
		List l = f.getContent();
		System.out.print(l);
		assertEquals(10, l.size());
	}
}
